﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace TWCRM.Controllers
{
    public class ToolsController : Controller
    {
        public ActionResult GetValidateCodeImage()
        {

            ValidateCode vCode = new ValidateCode();

            string code = vCode.CreateValidateCode(5);

            Session["pc-ValidateCode"] = code;

            byte[] bytes = vCode.CreateValidateGraphic(code);

            return File(bytes, @"image/jpeg");

        }

        public ActionResult GetValidateCode()
        {

            return this.Json(Session["pc-ValidateCode"], JsonRequestBehavior.AllowGet);

        }

    }
}
